package com.deuwise.job.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.deuwise.job.entity.TaskDo;
import com.deuwise.job.service.TaskDoService;
import com.deuwise.job.mapper.TaskDoMapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * 任务调度 接口实现类
 *@author deuwise
 *@date 2018-11-26 10:50:40
 **/
@Service
public class TaskDoServiceImpl extends ServiceImpl<TaskDoMapper, TaskDo> implements TaskDoService {

    Logger logger= LoggerFactory.getLogger(TaskDoServiceImpl.class);


    @Override
    public Integer queryByName(String name, TaskDo taskDo) {
        Wrapper<TaskDo> taskDoWrapper=new EntityWrapper<>();
        taskDoWrapper.eq("job_name",name);
        if(taskDo!=null){
            taskDoWrapper.ne("id",taskDo.getId());
        }
        return baseMapper.selectCount(taskDoWrapper);
    }
}